﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLNS_Public;
using System.Data;

namespace QLNS_Data
{
   public class BaoHiem_Data
    {
       KetNoiCSDL_Data kn = new KetNoiCSDL_Data();


       public DataTable LayDuLieu()
       {
           return kn.LayDuLieu("Load_tbl_BaoHiem");
       }
       public DataTable TaoBang(string sql)
       {
           return kn.taobang(sql);
       }
       public int update_BaoHiem(BaoHiem_Public maBaoHiem, BaoHiem_Public maNhanVien, BaoHiem_Public ngayCapSo, BaoHiem_Public noiCapSo, BaoHiem_Public ghiChu)
       {
           int n = 5;
           string[] name = new string[n];
           object[] value = new object[n];
           name[0] = "@MaSoBaoHiem";
           value[0] = maBaoHiem.MaSoBaoHiem;
           name[1] = "@MaNhanVien";
           value[1] = maNhanVien.MaNhanVien;
           name[2] = "@NgayCapSo";
           value[2] = ngayCapSo.NgayCapSo;
           name[3] = "@NoiCapSo";
           value[3] = noiCapSo.NoiCapSo;
           name[4] = "@GhiChu";
           value[4] = ghiChu.GhiChu;
           return kn.update("Update_BaoHiem",name,value,n);
       }
       public int insert_BaoHiem(BaoHiem_Public maNhanVien, BaoHiem_Public ngayCapSo, BaoHiem_Public noiCapSo, BaoHiem_Public ghiChu)
       {
           int n = 4;
           string[] name = new string[n];
           object[] value = new object[n];
           name[0] = "@MaNhanVien";
           value[0] = maNhanVien.MaNhanVien;
           name[1] = "@NgayCapSo";
           value[1] = ngayCapSo.NgayCapSo;
           name[2] = "@NoiCapSo";
           value[2] = noiCapSo.NoiCapSo;
           name[3] = "@GhiChu";
           value[3] = ghiChu.GhiChu;
           return kn.update("Insert_BaoHiem", name, value, n);
       }
       public int delete_BaoHiem(BaoHiem_Public maBaoHiem)
       {
           int n =1;
           string[] name = new string[n];
           object[] value = new object[n];
           name[0] = "@MaSoBaoHiem";
           value[0] = maBaoHiem.MaSoBaoHiem;
           return kn.update("Delete_BaoHiem", name, value, n);
       }
    }
}
